﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class admin_func_intro_m : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int no = int.Parse(Request["no"]);
        if (!IsPostBack)
        {
            ctpDataContext db = new ctpDataContext();

            var data = from p in db.ct_s_intros
                       where p.ct_s_no == no
                       select p.intro;
            if (data.Count() == 0)
            { }
            else
            {
                this.TextBox2.Text = data.First();
            }

            this.DropDownList1.DataSource = data;
            this.DropDownList1.DataBind();
        }
    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        this.TextBox2.Text = this.DropDownList1.SelectedValue;
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        ctpDataContext db = new ctpDataContext();

        ct_s_intro cts = db.ct_s_intros.Single(p => p.intro == this.DropDownList1.SelectedValue);
        cts.intro = this.TextBox2.Text;
        db.SubmitChanges();
    }
}
